"""CreateVerificationCodesTable Migration."""

from masoniteorm.migrations import Migration


class CreateVerificationCodesTable(Migration):
    def up(self):
        with create('verification_codes') as table:
            table.increments('id')
            table.integer('user_id').unsigned()
            table.foreign('user_id').references('id').on('users')
            table.string('code')
            table.timestamps()
            table.datetime('expires_at')
            table.boolean('is_used').default(False)

    def down(self):
        self.schema.drop('verification_codes')
